import { createStore } from 'vuex'
import createPersistedState from 'vuex-persistedstate'
import cart from './modeles/cart'
import category from './modeles/category'
import user from './modeles/user'
export default createStore({
  modules: {
    cart,
    category,
    user
  },
  plugins: [
    createPersistedState({
      key: 'erabbit-pc',
      paths: ['user', 'cart']
    })
  ]
})
// export default createStore({
//   state: {
//     username: '张三'
//   },
//   getters: {
//     username1 (state) {
//       return state.username
//     }
//   },
//   mutations: {
//     changename (state) {
//       console.log(state)
//       state.username = '李四'
//     }
//   },
//   actions: {
//     changename (ctx) {
//       setTimeout(() => {
//         ctx.commit('changename')
//       }, 1000)
//     }
//   },
//   modules: {
//   }
// })
